#include "plusOne.h"

std::vector<int> plusOne(std::vector<int>& digits)
{
	bool isContinue = true;
	int jinwei = 0;
	std::vector<int>::iterator it = digits.end() - 1;

	*it = *it + 1;

	while (isContinue)
	{
		*it = *it + jinwei;
		if ((*it / 10) == 0)
		{
			break;
		}
		else
		{
			*it = (*it) % 10;
			jinwei = 1;
		}

		if (it == digits.begin() && jinwei == 1)
		{
			digits.insert(it, 1);
			break;
		}
		it--;
	}
	return digits;
}
